<?php
header('Content-type:text/html;charset=utf8');
/**
 * sql语句封装执行函数
 * xysc users Version1.0
 * ==================================
 * Copy 2016-2017
 * Web:www.xjh7.com
 * ==================================
 * Author:xjh
 * Date:2016-3-6
*/

class CCCModel {
	/**
	 * 更新方法
	 * @param unknown_type $_sql
	 */
	public function upd($_sql){
		$connection = Yii::app()->db;
		$result = $connection->createCommand($_sql)->execute();
		return $result;
	}
	/**
	 * 自定义sql查询方法
	 * @param unknown_type $_sql
	 */
	public function sel($_sql){
		$connection = Yii::app()->db;
		$command = $connection->createCommand($_sql);
		$result = $command->queryAll();
		return $result;
	}
	/**
	 * 计数方法
	 * @param unknown_type $_sql
	 */
	public function getCount($_sql){
		$result = yii::app()->db->createCommand($sql)->query()->rowCount;
		return $result;
	}
	
}

?>